{template 'admin','header'}
{template 'admin','content_menu'}
<form name="searchform" action="{$self_url}" method="get">
<input type="hidden" name="catid" value="{$catid}">
<input type="hidden" name="module" value="{$module_name}">
<input type="hidden" name="bkforward" value="{$bkforward}">
<table cellpadding="0" cellspacing="1" class="table_list">
    <caption>内容查询</caption>
    <tr>
		<td class="align_c">
			<select name="status">
                <option value="">所有文章</option>
                {loop $status_list $i $s}
                <option value="{$i}">{$s}</option>
                {/loop}
            </select>
            <script>$("select[name=status]").val('{$status}')</script>
            <select name="type">
                <option value="1">按标题</option>
                <option value="2">按用户发表</option>
                <option value="3">按ID</option>
            </select>
            <script>$("select[name=type]").val('{$type}')</script>
            <input type="text" id="searchtext" name="searchtext" size="10" value="{$searchtext}"/>
            发布时间 {date_tool('starttime',isset($starttime)?$starttime:'')} - {date_tool('endtime',isset($endtime)?$endtime:'')}
			<input type="submit" name="doquery" value="查询" id="doquery" class="button_style"/>
		</td>
    </tr>
</table>
</form>
<form method="post" name="myform" action="{$self_url}?action=listorder" onsubmit="return r_submit(this);">
<input type="hidden" name="catid" value="{$catid}">
<table cellpadding="0" cellspacing="1" class="table_list">
    <caption>内容列表</caption>
    <tr>
        <th width="30">选中</th>
		<th width="30">排序</th>
        {loop $model['fields'] $f}
		{if $f['showlist']}
			{php $class=$f['formtype']; $classname='field_'.$class;}
			{php $obj_name = $class.'_obj_'.$f['field'];include_once(APP_ROOT.'include/fields/'.$class.'.class.php');}
			{php $$obj_name=new $classname($f);}
			{if method_exists($$obj_name,'set_format')}
				{php $$obj_name->set_format();}
			{/if}
		<th>{$f['name']}</th>
		{/if}
        {/loop}
		<th width="100">发布人</th>
		<th width="100">发布时间</th>
        <th width="130">管理操作</th>
    </tr>
    {loop $data $r}
    <tr>
        <td class="align_c"><input type="checkbox" size="5" name="selected[]" value="{$r['id']}"></td>
		<td class="align_c" width="30"><input name="info[{$r['id']}]" value="{$r['listorder']}" size="3" type="text"></td>
        {loop $model['fields'] $f}
		{if $f['showlist']}
        <td class="align_l">
            {if $f['field']=='title'}
                {if !empty($r['style'])}<span style="{$r['style']}">{$r[$f['field']]}</span>{else}{$r[$f['field']]}{/if}
                {if !empty($r['thumb'])}<span style="color:red">[图]</span>{/if}
            {else}
            	{php $class=$f['formtype'];$obj_name = $class.'_obj_'.$f['field'];}
				{if method_exists($$obj_name,'set_format')}
					{php echo $$obj_name->formate_value($r[$f['field']]);}
				{else}
					{$r[$f['field']]}
				{/if}
            {/if}
        </td>
        {/if}
        {/loop}
		<td class="align_c">{$r['username']}</td>
        <td class="align_c">{date('Y-m-d',$r['addtime'])}</td>
		<td class="align_c">
            {if $c->check_perms($catid, 'CON005')}
			<a href="{$self_url}?action=edit&module={$module_name}&catid={$r['catid']}&id={$r['id']}&site_id={$site_id}">修改</a>
            {/if}
		</td>
    </tr>
    {/loop}
</table>
<div class="button_box">
    <a href="javascript:void(0);" onclick="$('form[name=myform]').find('input:checkbox').attr('checked','true')">全选</a>/<a href="javascript:void(0);" onclick="$('form[name=myform]').find('input:checkbox').attr('checked','')">取消</a>
    {if $c->check_perms($catid, 'CON007')}
	<input name="dosubmit" type="button" value=" 排序 "  onclick="change_opt('myform','{$self_url}?action=listorder&module={$module_name}')">&nbsp;
    {/if}
    {if $c->check_perms($catid, 'CON006')}
	<input name="add" type="button" value=" 批量删除 " onclick="if(confirm('确定要删除所选择的内容吗？')){change_opt('myform','{$self_url}?action=delete_all&module={$module_name}');}">
    {/if}
    {if $module_name !='category'}<input type="button" value="返回上一级" onclick="self.location='{$back}'">{/if}
</div>
<div id="pages">{$pages}</div>
</form>
{template 'admin','footer'}